package com.gemini.main.common.bean;

import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * Wisdytech.cn
 * com.gemini.main.common.bean.AbstractAuditable
 *
 * @author hailin.zhl
 * @d2018/12/07
 */
@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @CreatedBy
    @Column(name = "create_user")
    private String createUser;

    @CreatedDate
    @Column(name = "create_date")
    private Date createDate;

    @LastModifiedBy
    @Column(name = "update_user")
    private String updateUser;

    @LastModifiedDate
    @Column(name = "update_date")
    private Date updateDate;
}
